<?php
    
    class ElementTopbarDatabase extends Element {
        public function Render() {
            global $db;
            global $server;

            $databases = array();
            if ( !isset( $server[ 'loginrequired' ] ) ) {
                $databases = $db->AllDatabases();
            }

            ?><div class="item">
                <a href="" onclick=""><img src="images/database.png" alt="database" title="Database" /></a>
                <select id="dbselect" name="database" onchange="Database.Select( this, '<?php
                echo $server[ 'name' ];
                ?>' )" style="min-width: 100px;"><?php
                    foreach ( $databases as $name ) {
                        ?><option<?php
                        if ( $name == $db->Name() ) {
                            ?> selected="selected"<?php
                        }
                        ?>><?php
                        echo $name;
                        ?></option><?php
                    }
                    if ( !isset( $server[ 'loginrequired' ] ) ) {
                        ?><option value="##new##" class="createopt">New database..</option><?php
                    }
                ?></select><?php
                Element( 'modal/createdb' ); 
            ?></div><?php
        }
    }

?>
